package com.googlecode.skald.server.demo;

/**
 * A small red ball, good for throwing.
 * 
 * @author Zach Tomaszewski
 */
public class Ball extends WorldObject {

  @Override
  public Afforded affordsDobj(Action act) {
    switch (act) {
      case EXAMINE:
        return Afforded.STRONGLY;
      case GET:
        return (this.getLocation() == GameWorld.pc) ? 
            Afforded.WEAKLY : 
            Afforded.STRONGLY;
      case THROW_AT:
      case THROW_FOR:
        return (this.getLocation() == GameWorld.pc) ? 
            Afforded.STRONGLY : 
            Afforded.WEAKLY;
      default:
        return Afforded.NOT;
    }
  }

  @Override
  public String dobjOf(Action act, WorldObject dobj, WorldObject iobj)
      throws ActionAbortedException {
    switch (act) {
      case EXAMINE:
        return "<p>The " + this + " is small, red, and covered in shiny dog-" +
        		"slobber.  Its surface is pitted with little toothmarks.</p>";
      case GET:
        if (this.getLocation() == GameWorld.pc) {
          return "<p>You are already holding the slobber-covered " + this + ".</p>";
        }else {
          this.moveTo(GameWorld.pc);
          return "<p>You pick up the " + this + ". Eww! It's warm and slippery.</p>";
        }
      default:
        return "";
    }
  }  
}
